package com.gitee.xhs.operatorState.unionListState;

import com.gitee.xhs.EnvironmentConfig;
import com.gitee.xhs.FlinkEnvironmentFactory;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import static com.gitee.xhs.operatorState.unionListState.OperatorUnionListStateConstant.OPERATOR_UNION_LIST_STATE_PATH;
import static com.gitee.xhs.operatorState.unionListState.OperatorUnionListStateConstant.OPERATOR_UNION_LIST_STATE_UID;

/**
 * @author BigHead
 * @date 2022/7/1 14:48
 * @description OperatorListStateMain
 */
public class OperatorUnionListStateMain {

    public static void main(String[] args) throws Exception {
        EnvironmentConfig environmentConfiguration = new EnvironmentConfig(null);
        environmentConfiguration.checkpoint(
                null,
                null,
                OPERATOR_UNION_LIST_STATE_PATH,
                null
        );

        StreamExecutionEnvironment streamExecutionEnvironment = FlinkEnvironmentFactory.simpleEnv(environmentConfiguration);
        streamExecutionEnvironment
                .addSource(
                        new OperatorUnionListStateSource()
                ).uid(OPERATOR_UNION_LIST_STATE_UID).setParallelism(2)
                .print();

        streamExecutionEnvironment.execute("OperatorUnionListStateMain");
    }

}
